import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    meta: {
      title: '首页',
      keepAlive: true
    }
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login.vue')
  },
  {
    path: '/dynamic',
    name: 'dynamic',
    component: () => import('../views/dynamic.vue')
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import('../views/mine.vue')
  },
  {
    path: '/detail',
    name: 'detail',
    component: () => import('../views/detail.vue'),
    meta: {
      keepAlive: false
    }
  },
  {
    path: '/searchRes',
    name: 'searchRes',
    component: () => import('../views/searchRes.vue'),
    // meta: {
    //   title: '搜索',
    //   keepAlive: true
    // }
  },
  {
    path: '/news',
    name: 'new',
    component: () => import('../views/newAni.vue')
  },
  {
    path: '/timeLine',
    name: 'timeLine',
    component: () => import('../views/timeLine.vue')
  },
  {
    path: '/hotCenter',
    name: 'hotCenter',
    component: () => import('../views/hotCenter.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
